/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-10-28
 * Time: 22:06
 */
import java.util.Scanner;

abstract class Animal{
    private String name;  //名字
    private int age;   //年龄

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
}
interface IAbility{
    void showInfo();  //输出动物信息
    void cry();    //动物发出叫声
}
class Dog extends Animal implements IAbility{

    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void showInfo() {
        System.out.println("我是一只狗,我的名字是"+ getName() +",今年"+getAge()+"岁");
    }

    @Override
    public void cry() {
        System.out.println("旺旺");
    }
}
class Cat extends Animal implements IAbility{

    public Cat(String name, int age) {
        super(name, age);
    }

    @Override
    public void showInfo() {
        System.out.println("我是一只猫,我的名字是"+getName()+",今年"+getAge()+"岁");
    }

    @Override
    public void cry() {
        System.out.println("喵喵");
    }
}
class Simulator{
    void playSound(IAbility animal){
        animal.showInfo();
        animal.cry();
    }
}


public class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        IAbility animal=null;
        int type=input.nextInt();
        String name=input.next();
        int age=input.nextInt();
        if (type==1)
            animal=new Dog(name,age);
        else
            animal=new Cat(name,age);

        Simulator sim=new Simulator();
        sim.playSound(animal);
        input.close();
    }
}
